package io

import "sort"

type CardSorter interface {
	Sort(cards []Card) ([]Card)
}

func (c CardSlice) Len() int {
	return len(c)
}

func (c CardSlice) Swap(i, j int) {
	c[i], c[j] = c[j], c[i]
}

func (c CardSlice) Less(i, j int) bool {
	return c[i].Id < c[j].Id
}

func (c CardSlice) Sort() {
	if !sort.IsSorted(c) {
		sort.Sort(c)
	}
}